﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master/manager.master" AutoEventWireup="true"
    CodeBehind="fare_rules.aspx.cs" Inherits="RailwayReservationWeb.manager.fare_rules" %>

<asp:Content ID="Content2" ContentPlaceHolderID="PathContent" runat="server">
    <ol class="breadcrumb">
        <li><a href="default.aspx">Home</a></li>
        <li class="active"><a href="fare_rules.aspx">Fare Rules</a></li>
    </ol>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="page-header">
        <h1>
            Fare Rules</h1>
    </div>
    <asp:GridView ID="gvwFares" runat="server" AutoGenerateColumns="False" DataSourceID="ldsFares"
        Width="100%" CssClass="table table-condensed table-bordered table-striped table-hover"
        OnRowCommand="gvwFares_RowCommand">
        <Columns>
            <asp:BoundField DataField="TrainTypeId" HeaderText="TrainTypeId" SortExpression="TrainTypeId"
                Visible="False" />
            <asp:TemplateField HeaderText="Train Type" SortExpression="TrainTypeId">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# GetTrainTypeName((Int32)Eval("TrainTypeId")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="_1AC" HeaderText="1AC" SortExpression="_1AC" />
            <asp:BoundField DataField="_2AC" HeaderText="2AC" SortExpression="_2AC" />
            <asp:BoundField DataField="_3AC" HeaderText="3AC" SortExpression="_3AC" />
            <asp:BoundField DataField="Sleeper" HeaderText="Sleeper" SortExpression="Sleeper" />
            <asp:BoundField DataField="General" HeaderText="General" SortExpression="General" />
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="Update" />
                    &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="AltEdit"
                        CommandArgument='<%# Bind("TrainTypeId") %>' CssClass="btn btn-default" Text="Edit" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:LinqDataSource ID="ldsFares" runat="server" ContextTypeName="RailwayReservationWeb.RailwayReservationDataContext"
        EntityTypeName="" TableName="Fares" EnableUpdate="True">
    </asp:LinqDataSource>
    <asp:HiddenField ID="txtTrainTypeId" runat="server" />
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">
                        Fare Information</h4>
                </div>
                <div class="modal-body">
                    <p id="pMessage" runat="server" class="alert alert-danger">
                    </p>
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="alert alert-danger"
                        DisplayMode="List" />
                    <div class="form-horizontal">
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label7" AssociatedControlID="txtTrainType" runat="server" Text="Train Type"
                                    CssClass="control-label"></asp:Label>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txtTrainType" runat="server" TextMode="SingleLine" CssClass="form-control"
                                    ReadOnly="True"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label1" runat="server" Text="1AC" AssociatedControlID="txt1AC" CssClass="control-label"></asp:Label>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please input Fare of 1AC"
                                    ForeColor="Red" ControlToValidate="txt1AC">∗</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txt1AC"
                                    ErrorMessage="Fare of 1AC must be numeric" ForeColor="White" ValidationExpression="^[0-9]{1,}$">&lt;</asp:RegularExpressionValidator>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txt1AC" runat="server" TextMode="SingleLine" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label2" runat="server" Text="2AC" AssociatedControlID="txt2AC" CssClass="control-label"></asp:Label>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please input Fare of 2AC"
                                    ForeColor="Red" ControlToValidate="txt2AC">∗</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txt2AC"
                                    ErrorMessage="Fare of 2AC must be numeric" ForeColor="White" ValidationExpression="^[0-9]{1,}$">&lt;</asp:RegularExpressionValidator>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txt2AC" runat="server" TextMode="SingleLine" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label3" runat="server" Text="3AC" AssociatedControlID="txt3AC" CssClass="control-label"></asp:Label>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please input Fare of 3AC"
                                    ForeColor="Red" ControlToValidate="txt3AC">∗</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txt3AC"
                                    ErrorMessage="Fare of 3AC must be numeric" ForeColor="White" ValidationExpression="^[0-9]{1,}$">&lt;</asp:RegularExpressionValidator>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txt3AC" runat="server" TextMode="SingleLine" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label4" runat="server" Text="Sleeper" AssociatedControlID="txtSleeper"
                                    CssClass="control-label"></asp:Label>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Please input Fare of Sleeper"
                                    ForeColor="Red" ControlToValidate="txtSleeper">∗</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtSleeper"
                                    ErrorMessage="Fare of Sleeper must be numeric" ForeColor="White" ValidationExpression="^[0-9]{1,}$">&lt;</asp:RegularExpressionValidator>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txtSleeper" runat="server" TextMode="SingleLine" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                <asp:Label ID="Label5" runat="server" Text="General" AssociatedControlID="txtGeneral"
                                    CssClass="control-label"></asp:Label>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="Please input Fare of General"
                                    ForeColor="Red" ControlToValidate="txtGeneral">∗</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtGeneral"
                                    ErrorMessage="Fare of General must be numeric" ForeColor="White" ValidationExpression="^[0-9]{1,}$">&lt;</asp:RegularExpressionValidator>
                            </div>
                            <div class="col-md-9">
                                <asp:TextBox ID="txtGeneral" runat="server" TextMode="SingleLine" CssClass="form-control"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        Close</button>
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="btn btn-primary"
                        OnClick="btnSubmit_Click" />
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="SideContent" runat="server">
    <div class="panel panel-primary panel-navi">
        <!-- Default panel contents -->
        <div class="panel-heading">
            Manage Stations</div>
        <!-- List group -->
        <ul class="list-group">
            <li class="list-group-item"><a href="station_list.aspx">View Stations List</a></li>
            <li class="list-group-item"><a href="station_add.aspx">Add New Station</a></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content5" runat="server" ContentPlaceHolderID="EndContent">
    <asp:PlaceHolder ID="phModal" runat="server"></asp:PlaceHolder>
</asp:Content>
